/**
 * 
 */
package com.gragra.dependencyParsing;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import com.gragra.parseOptions.ListOfDoubleOption;
import com.gragra.parseOptions.Parser;
import com.gragra.sampling.PopulationProbabilityAssigner;
import com.gragra.sampling.nonproj.DMVRoot;
/**
 * @author Christoph Teichmann
 * 25.09.2013
 */
public class DMVTypeRoot extends DisHeadModel
{
	/**
	 * 
	 */
	private double	functRootConstraint = 5.0;
	/**
	 * 
	 */
	private final static String funcRootOpt = "fPen";
	/**
	 * 
	 */
	private double	nounRootConstraint = 5.0;
	/**
	 * @return the functRootConstraint
	 */
	protected double getFunctRootConstraint()
	{return this.functRootConstraint;}
	/**
	 * @return the nounRootConstraint
	 */
	protected double getNounRootConstraint()
	{return this.nounRootConstraint;}
	/**
	 * 
	 */
	private final static String nounRootOpt = "nPen";

	/* (non-Javadoc)
	 * @see com.gragra.dependencyParsing.SimpleDMV#setParameters(com.gragra.parseOptions.Parser)
	 */
	@Override
	protected void setParameters(Parser pa)
	{
		this.functRootConstraint = (this.getValOrDefault(funcRootOpt, functRootConstraint, pa));
		this.nounRootConstraint = (this.getValOrDefault(nounRootOpt, nounRootConstraint, pa));
		super.setParameters(pa);
	}

	/* (non-Javadoc)
	 * @see com.gragra.dependencyParsing.SimpleDMV#addParameters(com.gragra.parseOptions.Parser)
	 */
	@Override
	public void addParameters(Parser pa)
	{
		pa.addOption(funcRootOpt, new ListOfDoubleOption("set this option to a exponent for the constraint used to penalize function words as roots, the inverse will be used, default is 5.0"));
		pa.addOption(nounRootOpt, new ListOfDoubleOption("set this option to a exponent for the constraint used to penalize nouns as sentence roots, the inverse will be used, default value is 5.0"));
		super.addParameters(pa);
	}
	/* (non-Javadoc)
	 * @see com.gragra.dependencyParsing.SimpleDMV#makeModel(it.unimi.dsi.fastutil.ints.IntOpenHashSet)
	 */
	@Override
	protected PopulationProbabilityAssigner makeModel(IntOpenHashSet is)
	{return new DMVRoot(this.getThreads(), is, getHeadAlpha(), getStopAlpha(), nounRootConstraint, functRootConstraint,
																						this.getStructAnnMax(),this.getStructAnnRed());}
}